
#ifndef _RED_BLACK_TREE_H_
#define _RED_BLACK_TREE_H_

#include "util.h"
typedef struct tagRBNode
{
	void *data;
	struct tagRBNode *left;
	struct tagRBNode *right;
	struct tagRBNode *p;
	int red;
} RBNode;

typedef int (*CompareFunc)(const void *, const void *);
typedef struct tagRBTree
{
	CompareFunc Compare;
	RBNode *root;
	size_t nodeCount;
} RBTree;

RBNode *RBNodeInsert(RBTree *, void *);
RBTree *CreateRBTree(CompareFunc);
void ReleaseTree(RBTree *);

#endif